import http from "./request.ts"

export const userAdminLogin = (parms: IAdminLoginParam): RES<ITokenInfo> => http.post("admin/login", parms)

export const userInfo = (): RES<IUserInfo> => http.get("admin/info")

export const adminList = (params: IadminList): RES<IAdminList> => http.get("admin/list", { params })

export const updateStatus = (id: number, status: number): Promise<IResponse<number>> => http.post(`admin/updateStatus/${id}?status=${status}`)

export const adminRegister = (parms: AdminList): RES<AdminList> => http.post("admin/register", parms)

export const getAdminInfo = (id: number): RES<AdminList> => http.get(`/admin/${id}`)

export const adminUpdata = (params: AdminList): RES<number> => http.post(`admin/update/${params.id}`, params)

export const getAdminRole = (id: number): RES<roleList[]> => http.get(`/admin/role/${id}`)

export const adminRoleUpdate = (params: { roleIds: number[], adminId: number }): RES<number> => http.post(`admin/role/update?roleIds=${params.roleIds}&adminId=${params.adminId}`)



